<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> </title>
</head>

<body>
    <input type="text" name="name" id="inp" placeholder="Search..." 
           onfocus="changeInput()" onchange="show(this)">
    <br>
    <span class="s1">你好</span>
    <span class="s2" hidden="hidden">你好</span>
  
</body>
  <script>
        // 改变input输入框的样式
        function changeInput() {
            let inp = document.querySelector("#inp")
            inp.style.height = "100px"
            inp.style.border = "2px solid blue"
            inp.style.outline = "none"
        }

        function show(input) {
            // 获取输入框的值
            let val = input.value;
            console.log(val);

            // 获取span标签元素
            let s1 = document.getElementsByClassName("s1")[0]
            s1.innerHTML = "<font style='font-size:24px;color:red'>" + val + "</font>"

            let s2 = document.getElementsByClassName("s2")[0]
            s2.style.display = "inline-block"//元素从隐藏状态变为可见，并且以 行内块级元素 的方式显示。
            s2.innerText = val;
        }
    </script>
</html>